from flask import request
from flask.views import MethodView

from qingdeng.orms import CategoryORM


class CategoryAPI(MethodView):
    def get(self, category_id):
        # 接口只返回数据,不返回模板
        category_list = CategoryORM.query.all()
        print("category_list", category_list)
        return {
            "code": 0,
            "msg": "获取数据成功",
            "count": len(category_list),
            "data": [c.json() for c in category_list],
        }

    def post(self):
        pass

    def put(self, category_id):
        pass

    def delete(self, category_id):
        pass
